home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / inadv023.zip / tstquick.cmd < prev    next >
OS/2 REXX Batch file  |  1996-06-01  |  2KB  |  96 lines

  1. /*
  2. ------------------------
  3. Test Quicklist routines
  4. ------------------------
  5. */
  6.  
  7. say "Trying to load/register Internet Adventurer REXX API"
  8. if RxFuncQuery("IARX_Register") <> 0 then do
  9.    rc = RxFuncAdd("IARX_Register","IA_UTILS","IARX_Register")
  10.    if rc <> 0 then do
  11.       say "-------------------------------------"
  12.       say "Error loading Internet Adventurer API"
  13.       say "-------------------------------------"
  14.       exit(1)
  15.    end
  16. end
  17.  
  18. rc = IARX_Register();
  19. if rc then do
  20.    say "-------------------------------------"
  21.    say "Error loading Internet Adventurer API"
  22.    say "-------------------------------------"
  23.    exit(1)
  24. end
  25.  
  26. say "Opening database"
  27. ptr = IARX_QOpenDatabase();
  28. if length(ptr) > 0 then do
  29.    say "-------------------------------------"
  30.    say "Opening database gave this:" ptr
  31.    say "-------------------------------------"
  32.    exit(1)
  33. end
  34.  
  35. say "Database opened"
  36.  
  37. signal on novalue name handlenovalue
  38. signal on error   name handleerror
  39. signal on syntax  name handleerror
  40.  
  41. rc = IARX_QMakeTree("t",0);
  42. if rc <> 0 then do
  43.    say "No items found"
  44. end
  45. else do
  46.    say t.items "items found"
  47.    do i = 1 to t.items by 1
  48.       say "Title:" t.i.title
  49.       if t.i.type = 1 then
  50.          say "URL  :" t.i.url
  51.    end
  52. end
  53.  
  54. drop t.
  55.  
  56. say "Closing database"
  57. rc = IARX_QCloseDatabase()
  58.  
  59. exit(0)
  60.  
  61.  
  62. /*
  63. -------------
  64. Handle errors
  65. -------------
  66. Upon entry to this function, the contents of the variables are:
  67. rc   - Error code
  68. sigl - Line number, error occured in.
  69.  
  70. Now we just display the error code and text followed by the
  71. source-line with the problem
  72. */
  73.  
  74. handleerror:
  75.  
  76. say "REXX Error" rc "in line" sigl ":" errortext(rc);
  77. say "-----";
  78. say "-----" sourceline(sigl);
  79. say "-----";
  80. rc = IARX_QCloseDatabase();
  81. exit;
  82.  
  83. /*
  84. ------------------------------
  85. Handle variables without value
  86. ------------------------------
  87. */
  88. handlenovalue:
  89.  
  90. say "REXX Error, trying to reference variable with no value in line" sigl;
  91. say "-----";
  92. say "-----" sourceline(sigl);
  93. say "-----";
  94. rc = IARX_QCloseDatabase();
  95. exit;
  96.